package com.ewanghuiju.app.ui.pintuan.adapter;

import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.model.bean.response.PintuanClassifyResponBean;

public class ClassifyOfPintuanNameAdapter extends BaseQuickAdapter<PintuanClassifyResponBean, BaseViewHolder> {
    public ClassifyOfPintuanNameAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, PintuanClassifyResponBean item) {
        TextView tvName = helper.getView(R.id.goods_type_name);
        if (!TextUtils.isEmpty(item.getName())) {
            tvName.setText(item.getName());
        }
        if (item.getIsSelect() == 0) {
            helper.setBackgroundColor(R.id.classify_root, mContext.getResources().getColor(R.color.classify_left_normal_bg));
            helper.setVisible(R.id.classify_left_icon, false);
            tvName.setTextColor(mContext.getResources().getColor(R.color.color_666));
        } else {
            helper.setBackgroundColor(R.id.classify_root, mContext.getResources().getColor(R.color.white));
            helper.setVisible(R.id.classify_left_icon, true);
            tvName.setTextColor(mContext.getResources().getColor(R.color.colorPrimary));
        }
    }
}
